import React, {Component} from 'react';
import {
    StyleSheet,
    Text,
    View,
    Image,
    Dimensions,
    ListView,
    TouchableOpacity,
    Platform
} from 'react-native';

const {height, width} = Dimensions.get('window');
export default class OverlaySureRemind extends Component {
    constructor(props) {
        super(props);
        this.state = {
            leftMsg:this.props.leftMsg||'取消'
        }
    };
    closeOverlay=()=>{
        if(this.props.closeOverlay){
            this.props.closeOverlay("close")}
    };
    deleteOrder=()=>{
        if(this.props.deleteOrder){
            this.props.deleteOrder('delete')
        }
    };

    render() {
        return (
            <View style={{backgroundColor: Theme.defaultColor, minWidth: 260, minHeight: 120,
                borderRadius: 15, justifyContent: 'center', alignItems: 'center'}}>
                <View style={{flex:1,justifyContent:'center',alignItems:'center',width:230}}>
                    <Text style={{textAlign:'center',lineHeight:20,fontSize:15,color:'#000'}}>{this.props.text}</Text>
                </View>
                <View style={[{height:0.5,width:260},{backgroundColor:'#e2e2e3'}]}/>
                <View style={{width:260,height:44,flexDirection:'row',alignItems:'center'}}>
                    <TouchableOpacity
                        onPress={()=>this.closeOverlay()}
                        style={{flex:1,justifyContent:'center',alignItems:'center',width:(width-0.5/2),height:44}}>
                        <Text style={this.props.ID=='suppliers'?{color:suppliersThemeColor}:{color:PurchaserThemeColor}}>{this.state.leftMsg}</Text>
                    </TouchableOpacity>
                    <View style={[{width:0.5,height:44},{backgroundColor:'#e2e2e3'}]}/>
                    <TouchableOpacity
                        onPress={()=>this.deleteOrder()}
                        style={{flex:1,justifyContent:'center',alignItems:'center',width:(width-0.5/2),height:44}}>
                        <Text style={this.props.ID=='suppliers'?{color:suppliersThemeColor}:{color:PurchaserThemeColor}}>{this.props.buts}</Text>
                    </TouchableOpacity>
                </View>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: '#f0f0f0'
    },
});
